package com.example.pwj.ffstudy.ui.zhihu.adapter;

import android.content.Context;

import com.example.pwj.ffstudy.R;
import com.example.pwj.ffstudy.bean.zdaily.ZDailyNewsSection;
import com.example.pwj.ffstudy.bean.zdaily.ZDailyStory;
import com.example.pwj.ffstudy.comm.CommSectionAdapter;
import com.example.pwj.ffstudy.comm.CommViewHolder;

/**
 * Created by pwj on 2017/8/24.
 */

public class ZNewsAdapter extends CommSectionAdapter<ZDailyNewsSection> {

    public ZNewsAdapter(Context context) {
        super(context, R.layout.item_zhihu, R.layout.item_zhihu_section);
    }

    @Override
    protected void convertSection(CommViewHolder holder, ZDailyNewsSection zDailyNewsSection) {
        holder.setText(R.id.tv_zhihu_section, zDailyNewsSection.header);
    }

    @Override
    public void convert(CommViewHolder holder, ZDailyNewsSection zDailyNewsSection) {
        ZDailyStory zDailyStory = zDailyNewsSection.t;
        holder.setImageUrl(R.id.iv_zhihu, zDailyStory.getImages().get(0));
        holder.setText(R.id.tv_zhihu, zDailyStory.getTitle());
    }
}
